package com.welike.shibo.controller;

import com.welike.shibo.eneity.JsonResult;
import com.welike.shibo.enums.ResultEnum;
import com.welike.shibo.utils.ResultUtils;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author fangyu
 * @version v1.0.0
 * @since 2019/11/26 10:47 上午
 */
@Controller
public class NotFoundException implements ErrorController {
    @Override
    public String getErrorPath() {
        return "/error";
    }

    @RequestMapping(value = {"/error"})
    @ResponseBody
    public JsonResult error(HttpServletRequest request){
        return ResultUtils.error(ResultEnum.NOT_FOUND);
    }
}
